<div class="wrap">
    <div id="icon-upload" class="icon32"><br></div>
    <h2>Datové zdroje v rámci "{$frame.name}" <a href="{link target='self:addFrame'}" class="add-new-h2">Přidat datový rámec</a> </h2>
    {include file="messages.tpl"}
    <ul class="subsubsub">
        <li><a href="{link target='self:editItems' append="frameId"}"{if !isset($smarty.get.status_valid)} class="current"{/if}>Celkem <span class="count">({$cnt.all})</span></a> |</li>
        <li><a href="{link target='self:editItems' append="frameId" status_valid='now'}"{if $smarty.get.status_valid == 'now'} class="current"{/if}>Aktuální <span class="count">({$cnt.now})</span></a> |</li>
        <li><a href="{link target='self:editItems' append="frameId" status_valid='future'}"{if $smarty.get.status_valid == 'future'} class="current"{/if}>Budoucí <span class="count">({$cnt.future})</span></a> |</li>
        <li><a href="{link target='self:editItems' append="frameId" status_valid='past'}"{if $smarty.get.status_valid == 'past'} class="current"{/if}>Minulé <span class="count">({$cnt.past})</span></a></li>
    </ul>
    <form id="posts-filter" action="{link target='self:itemBulkAction'}" method="post">
        <input name="token" type="hidden" value="{wp_nonce target='self:itemBulkAction'}" />
        <input name="frameId" type="hidden" value="{$frame.frameId}" />
        <div class="tablenav top">
            <div class="alignleft actions">
                <select name="action1">
                    <option value="-1" selected="selected">Hromadné úpravy</option>
                    <option value="remove">Odstranit</option>
                </select>
                <input type="submit" name="" id="doaction" class="button-secondary action" value="Použít">
            </div>
            {include file="pager.tpl" position='top' pager=$pager page='editItems' append='orderBy,order'}
            <br class="clear">
        </div>
        <table class="wp-list-table widefat fixed pages" cellspacing="0">
            <thead>
                <tr>
                    <th scope="col" id="cb" class="manage-column column-cb check-column">
                        <input type="checkbox">
                    </th>    
                    <th scope="col" id="title" class="manage-column column-icon"></th>
                    <th scope="col" class="manage-column column-title {sortstate orderedBy='name'}" style="">
                        <a href="{sortlink orderBy='name' append='paged,frameId'}"><span>Název</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" class="manage-column column-title {sortstate orderedBy='content'}" style="">
                        <a href="{sortlink orderBy='content' append='paged,frameId'}"><span>Obsah</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" class="manage-column column-title {sortstate orderedBy='position'}">
                        <a href="{sortlink orderBy='position' append='paged,frameId'}"><span>Pozice</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" class="manage-column column-title {sortstate orderedBy='validFrom'}" style="">
                        <a href="{sortlink orderBy='validFrom' append='paged,frameId'}"><span>Platnost od</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" class="manage-column column-title {sortstate orderedBy='validTo'}" style="">
                        <a href="{sortlink orderBy='validTo' append='paged,frameId'}"><span>Platnost do</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th style="width: 150px"></th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <th scope="col" id="cb" class="manage-column column-cb check-column">
                        <input type="checkbox">
                    </th>    
                    <th scope="col" id="title" class="manage-column column-icon"></th>
                    <th scope="col" class="manage-column column-title {sortstate orderedBy='name'}" style="">
                        <a href="{sortlink orderBy='name' append='paged,frameId'}"><span>Název</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" class="manage-column column-title {sortstate orderedBy='content'}" style="">
                        <a href="{sortlink orderBy='content' append='paged,frameId'}"><span>Obsah</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" class="manage-column column-title {sortstate orderedBy='position'}">
                        <a href="{sortlink orderBy='position' append='paged,frameId'}"><span>Pozice</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" class="manage-column column-title {sortstate orderedBy='validFrom'}" style="">
                        <a href="{sortlink orderBy='validFrom' append='paged,frameId'}"><span>Platnost od</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" class="manage-column column-title {sortstate orderedBy='validTo'}" style="">
                        <a href="{sortlink orderBy='validTo' append='paged,frameId'}"><span>Platnost do</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th></th>
                </tr> 
            </tfoot>
            <tbody id="the-list">
                {foreach $frame_items as $frame_item} 
                <tr class="{cycle values='alternate,'}" valign="top">
                    <th scope="row" class="check-column"><input type="checkbox" name="post[]" value="{$item.itemId}"></th>                    
                    <td class="column-icon media-icon">
                        {if $frame_item.content == 'video'}
                        <img width="46" height="60" src="{site_url()}/wp-includes/images/crystal/video.png" class="attachment-80x60">
                        {elseif $frame_item.content == 'post'}
                        <img width="46" height="60" src="{site_url()}/wp-includes/images/crystal/text.png" class="attachment-80x60">
                        {elseif $frame_item.content == 'image'}
                        <img width="46" height="60" src="{plugins_url()}/ads-server/public/images/icons/crystal/image.png" class="attachment-80x60">
                        {/if}
                    </td>
                    <td class="post-title page-title column-title">                        
                        <strong>
                            <a class="row-title" href="{link target='datasource:editItems' sourceId=$frame_item.sourceId}" title="Upravit „{$frame.name|escape}“">{$frame_item.name|escape}</a>
                        </strong>
                        <div class="row-actions">
                            <span class="edit"><a href="{link target='self:editItem' itemId=$frame_item.itemId append='frameId'}" title="Upravit tuto položku">Upravit</a> | </span>
<!--                            {if $frame_item.position > 1}
                            <span class="edit"><a href="{link target='self:decreaseItemPosition' itemId=$frame_item.itemId append='frameId'}" title="Upravit tuto položku">Posunout výše</a> | </span>
                            {/if}
                            {if $frame_item.position < count($frame_items)}
                            <span class="edit"><a href="{link target='self:increaseItemPosition' itemId=$frame_item.itemId append='frameId'}" title="Upravit tuto položku">Posunout níže</a> | </span>
                            {/if}-->
                            <span class="trash"><a class="submitdelete" title="Přesunout tuto položku do koše" href="{link target='self:removeItem' itemId=$frame_item.itemId append='frameId' token='true'}">Odstranit</a></span>
                    </td> 
                    <td class="post-title page-title column-title">
                        {if $frame_item.content == 'video'}
                        Video
                        {elseif $frame_item.content == 'post'}
                        Příspěvky
                        {elseif $frame_item.content == 'image'}
                        Obrázky
                        {/if}
                    </td>
                    <td class="post-title page-title column-title">
                        {$frame_item.position|escape}
                    </td>                    
                   <td class="post-title page-title column-title">
                        {$frame_item.validFrom|escape}
                    </td>
                    <td class="post-title page-title column-title">
                        {$frame_item.validTo|escape}
                    </td>
                    <td class="post-title page-title column-title">                        
                        {if $frame_item.position < count($frame_items)}
                        <a href="{link target='self:increaseItemPosition' itemId=$frame_item.itemId append='frameId'}" class="ctrl icoArrowDown">Dolů</a>
                        {/if}
                        {if $frame_item.position > 1}
                        <a href="{link target='self:decreaseItemPosition' itemId=$frame_item.itemId append='frameId'}" class="ctrl icoArrowUp">Nahoru</a>
                        {/if}
                    </td>
                </tr>
                {foreachelse}
                <tr>
                    <td colspan="6">Nejsou zadány žádné položky.</td>
                </tr>
                {/foreach}
            </tbody>
        </table>
        <div class="tablenav bottom">
            <div class="alignleft actions">
                <select name="action2">
                    <option value="-1" selected="selected">Hromadné úpravy</option>
                    <option value="remove">Odstranit</option>
                </select>
                <input type="submit" name="" id="doaction2" class="button-secondary action" value="Použít">
            </div>
            <div class="alignleft actions">
            </div>
            {include file="pager.tpl" pager=$pager page='editItems' append='orderBy,order'}
            <br class="clear">
        </div>
    </form>
    <form name="addlink" id="addlink" method="post" action="{link target='self:editItems' append='frameId'}" style="width: 500px">
        <input type="hidden" name="action" value="add">
        <div id="poststuff" class="metabox-holder">            
            <div id="post-body">
                <div id="post-body-content">
                    <div class="stuffbox">
                        <h3><label for="link_name">Nový datový zdoj</label></h3>
                        <div class="inside"> 
                            <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
                                <tbody>
                                    <tr class="form-field">
                                        <th valign="top" scope="row"><label for="item[targetId]">Datový zdroj</label></th>
                                        <td>{html_options name="item[sourceId]" options=$data_sources selected=$item.sourceId}</td>
                                    </tr>
                                  <tr class="form-field">
                                        <th valign="top" scope="row"><label for="item[validFrom]">Platný od (yyyy-mm-dd hh:mm:ss)</label></th>
                                        <td><input type="text" name="item[validFrom]" size="30" tabindex="1" value="{$item.validFrom|escape}" class="ads_datepicker" /> </td>
                                    </tr>
                                    <tr class="form-field">
                                        <th valign="top" scope="row"><label for="item[validTo]">Platný do (yyyy-mm-dd hh:mm:ss)</label></th>
                                        <td><input type="text" name="item[validTo]" size="30" tabindex="1" value="{$item.validTo|escape}" class="ads_datepicker" /></td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="ads-form-footer">
                            <div id="major-publishing-actions">
                                <div id="delete-action">
                                    <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="Přidat datový zdroj">
                                </div>
                                <div id="publishing-action">

                                </div>
                                <div class="clear"></div>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
